<?php
if (isset($InputData['list_type'])) {
    //如果为作品待审核列表 加入审核按钮
    if ($InputData['list_type'] == work_m::ListTopicWait && $_SESSION['user_level'] >= 90) {
        $works_list_btn_show = 1;
    } //如果为作品选择加入本领列表
    elseif ($InputData['list_type'] == work_m::ListUserForField) {
        if (isset($_SESSION['user_field_work_list'])) {
            $user_field_work_list = array();
            $_user_field_work_list = explode(',', $_SESSION['user_field_work_list']);
            foreach ($_user_field_work_list as $value) {
                $user_field_work_list[$value] = 1;
            }
        }
        $works_list_btn_show = 2;
    } //如果为作品在本领中排序
    elseif ($InputData['list_type'] == work_m::ListUserFieldForOrder) {
        $works_list_btn_show = 3;
    } elseif ($InputData['list_type'] == work_m::ListUserForTopic) {
        $works_list_btn_show = 4;
        $i = 0;
        echo '<span id="msg_topic_id" style="display:none">' . $InputData['topic_id'] . '</span>';
    } else {
        $works_list_btn_show = 0;
    }
} else {
    $works_list_btn_show = 0;
}
if (isset($workList) && count($workList) > 0) {
    foreach ($workList as $workMsg) {
        $workImg = make_img_name::make_img_mini_name(explode(';', $workMsg->Picture, 2)[0]);
        if (count($workImg) > 0) {
            $isRecommend = $myWork->work_recommend_check($workMsg->Id);
            if ($isRecommend === true) $recommendIconEx = ''; else $recommendIconEx = '-o';
            $isCommend = $myWork->work_comment_check($workMsg->Id);
            if ($isCommend === true) $commendIconEx = ''; else $commendIconEx = '-o';
            ?>
            <li class="am-list-item" data-id="<?= $workMsg->Id ?>" style="padding:10px 0px 10px 25px">
                <?php if ($works_list_btn_show < 2){ ?>
                <a style="display: inline-block;"
                   onclick="goto_work_show(<?= $workMsg->Id ?>)">
                    <?php } ?>
                    <div class="am-list-thumb web-work-list-img" style="display: inline-block; vertical-align: top;">
                        <div class="app-img-flex"
                             style="background-image:url(<?= $CfgPara->httproot ?>/works_pic/<?= $workImg ?>);">
                        </div>
                    </div>
                    <div style="width: 20px; display: inline-block;"></div>
                    <div class="am-list-main" style="display: inline-block; vertical-align: top;">
                        <div class="am-list-item-hd">
                            <span class="web-main-color"><?= $workMsg->Name; ?></span>
                        </div>
                        <div class="am-list-item-text am-text-xs" style="padding-top: 2px;padding-bottom: 5px;">
                            <?= substr($workMsg->ReleaseDt, 0, 16) ?>
                        </div>
                        <div class="am-list-item-text">
                            <?php if ($workMsg->State == 1) { ?>
                            <i class="am-icon am-icon-heart<?= $recommendIconEx ?> am-icon-fw"></i><?= formatDataSize($workMsg->UpCount) ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <i class="am-icon am-icon-comment<?= $commendIconEx ?> am-icon-fw"></i><?= formatDataSize($workMsg->CommentCount) ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                <i class="am-icon am-icon-eye am-icon-fw"></i><?= formatDataSize($workMsg->ViewCount) ?>
                            <?php } else { ?>
                                <i class="am-icon am-icon-edit am-icon-fw"></i>草稿
                            <?php } ?>
                        </div>
                    </div>
                    <?php if ($works_list_btn_show < 2){ ?>
                </a>
            <?php } ?>
                <div class="am-fr web-gray-color" style="padding-right: 20px; padding-top: 20px;">
                    <?php
                    //作品待审核列表 加入审核按钮
                    if ($works_list_btn_show === 1) {
                        echo '<a class="web-btn-showlist app-btn-follow" onclick="topic_work_check(' . $InputData['topic_id'] . ',' . $workMsg->Id . ',this,1)">&nbsp;通过&nbsp;</a>&nbsp;&nbsp;';
                        echo '<a class="web-btn-showlist app-btn-follow-red" onclick="topic_work_check(' . $InputData['topic_id'] . ',' . $workMsg->Id . ',this,-1)">&nbsp;拒绝&nbsp;</a>';
                    } //作品选择加入本领列表
                    elseif ($works_list_btn_show === 2) {
                        if (!isset($user_field_work_list[$workMsg->Id]))
                            echo '<a class="web-btn-showlist app-btn-follow" onclick="user_field_add_work(' . $workMsg->Id . ',this)" datatype="1">加入</a>';
                        else
                            echo '<a class="web-btn-showlist app-btn-followed" onclick="user_field_add_work(' . $workMsg->Id . ',this)" datatype="0">取消</a>';
                    } //作品本领列表排序
                    elseif ($works_list_btn_show === 3) {
                        echo
                        '<span class="btn-field-order am-text-lg" style="display:none">
                <a class="am-icon-arrow-circle-o-up am-icon-fw web-main-color" onclick="user_field_order_up(this)"></a>
                <a class="am-icon-arrow-circle-o-down am-icon-fw web-main-color" onclick="user_field_order_down(this)"></a>
            </span>';
                    } //选择作品投稿到专题
                    elseif ($works_list_btn_show === 4) {
                        if ($topicAddCheckResult[$i] < 0)
                            echo '<a class="web-btn-showlist app-btn-follow" onclick="work_for_topic(this)" data-topic-msg="' . $InputData['topic_id'] . ',' . $workMsg->Id . '">加专题</a>';
                        elseif ($topicAddCheckResult[$i] == 1)
                            echo '<a class="web-btn-showlist app-btn-followed">已加入</a>';
                        elseif ($topicAddCheckResult[$i] == 0)
                            echo '<a class="web-btn-showlist app-btn-followed">待审核</a>';
                        $i++;
                    } else {
                        echo '<i class="am-icon am-icon-ellipsis-h"></i>';
                    }
                    ?>
                </div>
            </li>
        <?php } //if(count($workImg) > 0)结束
    }//foreach ($workList as $workMsg) 结束
} //if(isset($workList))结束
else //没有内容
{
    if (!isset($InputData['page_change']) || isset($InputData['search_text']))
        require("{$CfgPara->root}/view/warning_nocontent.app.v.php");
}
?>